#include "ToolBox/gl/material.h"

Material::Material()
{
    ambient= new Vectorf(0.4,0.4,0.4,1.0);
    diffuse= new Vectorf(0.8,0.8,0.8,1.0);
    specular= new Vectorf(0.8,0.8,0.8,1.0);
    shine=100;
}

Material::Material(Vectorf *aAmbient, Vectorf *aDiffuse, Vectorf *aSpecular)
{
    ambient=aAmbient;
    diffuse=aDiffuse;
    specular=aSpecular;
    shine=100;
}


void Material::SetAmbiant(Vectorf *vec)
{
    ambient=vec;
}

void Material::SetDiffuse(Vectorf *vec)
{
    diffuse=vec;
}

void Material::SetSpecular(Vectorf *vec)
{
    specular=vec;
}

void Material::UseMaterial()
{
    glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, ambient->Array());
    glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse->Array());
    glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, specular->Array());
    glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,shine);
}
